#include "gtest\gtest.h"
#include "point.h"
#include "size.h"
#include "rect.h"

namespace nsbase = nsshare::base;

namespace
{

TEST(GFXTest, Point)
{
    nsbase::Point pt0;
    nsbase::Point pt1 = nsbase::Point::Make(1, 2);
    nsbase::Point pt2(pt1);
    nsbase::Point pt3 = pt2;
    pt3.Offset(2,3);

    EXPECT_EQ(true, pt0 != pt1);
    pt0.set_x(1);
    EXPECT_EQ(true, pt0 != pt1);
    pt0.set_x(0);
    pt0.set_y(2);
    EXPECT_EQ(true, pt0 != pt1);

    EXPECT_EQ(true, pt1 == pt2);
    EXPECT_EQ(true, pt2 != pt3);
    EXPECT_EQ(3, pt3.x());
    EXPECT_EQ(5, pt3.y());
}

TEST(GFXTest, Size)
{
    nsbase::Size sz0;
    nsbase::Size sz1 = nsbase::Size::Make(1, 1);
    nsbase::Size sz2(sz1);
    nsbase::Size sz3 = sz2;

    EXPECT_EQ(true, sz0 != sz1);
    EXPECT_EQ(true, sz1 == sz2);
    EXPECT_EQ(true, sz2 == sz3);

    nsbase::Size sz4;
    sz4.SetSize(1, 1);
    EXPECT_EQ(1, sz4.width());
    EXPECT_EQ(1, sz4.height());
    sz4.set_width(2);
    sz4.set_height(3);
    EXPECT_EQ(2, sz4.width());
    EXPECT_EQ(3, sz4.height());
}

TEST(GFXTest, Rect)
{
    nsbase::Rect rt0;
    nsbase::Rect rt1 = nsbase::Rect::Make(1,2,3,4);
    nsbase::Rect rt2(rt1);
    nsbase::Rect rt3 = rt2;

    rt3.Offset(1, 2);

    EXPECT_EQ(true, rt2 == rt1);
    EXPECT_EQ(true, rt3 != rt2);
    /*
    TODO: Geometry Test
    */
}

}